package com.hornsun.domain.constant.types;

/**
 * Created by 编译中... on 2018/4/24.
 */
public enum CouponType {
    USABLE(1,"未使用"),
    USED(2,"已使用"),
    OVERDUE(3,"已过期");

    private Integer type;
    private String name;

    CouponType(Integer type ,String name){this.type=type;this.name=name;}

    public Integer getType() {
        return type;
    }

    public String getName() {
        return name;
    }

    public static CouponType fromName(String name) {
        for (CouponType couponType : values()) {
            if (couponType.name.equals(name)){
                return couponType;
            }
        }
        return null;
    }
}
